﻿using DocumentFormat.OpenXml.Lite.Helper;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.WordprocessingML.Word.ParagraphProperties
{
    [XmlRoot("ind", Namespace = Constants.WordMain)]
    public class Indentation : XmlSerializable, IParagraphPropElement
    {
        [Optional]
        [XmlAttribute("left", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Left {get;set;}

        [Optional]
        [XmlAttribute("leftChars", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> LeftChars { get; set; }

        [Optional]
        [XmlAttribute("right", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Right { get; set; }

        [Optional]
        [XmlAttribute("rightChars", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> RightChars {get;set;}

        [Optional]
        [XmlAttribute("hanging", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> Hanging { get; set; }

        [Optional]
        [XmlAttribute("hangingChars", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> HangingChars { get; set; }

        [Optional]
        [XmlAttribute("firstLine", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> FirstLine {get;set;}

        [Optional]
        [XmlAttribute("firstLineChars", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> FirstLineChars { get; set; }

        public Indentation() { }

        public void Copy(object obj)
        {
            if (obj is Indentation)
            {
                this.FirstLine = (obj as Indentation).FirstLine;
                this.FirstLineChars = (obj as Indentation).FirstLineChars;
                this.Hanging = (obj as Indentation).Hanging;
                this.HangingChars = (obj as Indentation).HangingChars;
                this.Left = (obj as Indentation).Left;
                this.LeftChars = (obj as Indentation).LeftChars;
                this.Right = (obj as Indentation).Right;
                this.RightChars = (obj as Indentation).RightChars;
            }
        }
    }
}
